package com.springboot.middleware.middleware_rushtopurchase.server.service;

import com.springboot.middleware.middleware_rushtopurchase.server.dto.BookRobDto;

public interface BookRobService {
    /**
     * 处理书籍抢购逻辑 - 不加锁
     * @param dto (用户id, 书籍编号)
     * @throws Exception 书籍库存不足
     */
    void robWithNoLock(BookRobDto dto) throws Exception;

    /**
     * 处理书籍抢购逻辑 - 加ZK分布式锁
     * @param dto (用户id, 书籍编号)
     * @throws Exception 书籍库存不足 / 获取ZK锁失败
     */
    void robWithZKLock(BookRobDto dto) throws Exception;
}
